<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/css/css/base.css">
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/css/css/style.css">
<script type="text/javascript"
	src="${pageContext.request.contextPath}/lib/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery-2.1.4.min.js"></script>
<title>订单管理</title>
</head>
<body onload="init()">
	<div class="page">
		<div class="header">
			<div class="header_top"></div>
			<div class="header_bottom clearfix">
				<div class="header_logo fl">
					<img
						src="${pageContext.request.contextPath}/images/images/index-logo.png">
				</div>
				<ul class="header_nav clearfix fl">
					<li><a
						href="${pageContext.request.contextPath}/morder/waitOrderList.html"
						class="on">订单管理</a></li>
					<li><a
						href="${pageContext.request.contextPath}/staff/queryAllList/1.html">家政人员管理</a>
					</li>
					<li><a
						href="${pageContext.request.contextPath}/supplier/account.html">财务管理</a>
					</li>
					<li><a
						href="${pageContext.request.contextPath}/admin/accountInfo.html">账户管理</a>
					</li>
				</ul>
				<div class="header_user fr">
					<img
						src="${pageContext.request.contextPath}/images/images/user.png">欢迎您，<i>${ sessionScope.MANAGER_NAME}
					</i><a href="${pageContext.request.contextPath}/manager/loginout.html">【切换账号】</a>
				</div>
			</div>
		</div>
		<div class="main clearfix">
			<div class="main_menu fl">


				<div class="menu_name on">
					<a
						href="${pageContext.request.contextPath}/morder/waitOrderList.html">
						<img
						src="${pageContext.request.contextPath}/images/images/ddc.png">
						<p>订单池</p>
					</a>
				</div>
				<div class="menu_name">
					<a
						href="${pageContext.request.contextPath}/need/waitNeedList/1.html">
						<img
						src="${pageContext.request.contextPath}/images/images/xqc.png">
						<p>需求池</p>
					</a>
				</div>
				<div class="menu_name">
					<a
						href="${pageContext.request.contextPath}/morder/allOrderList/3/1.html">
						<img
						src="${pageContext.request.contextPath}/images/images/wddd.png">
						<p>我的订单</p>
					</a>
				</div>

			</div>
			<div class="main_cont fl">
				<div class="main_cont_top">
					<div class="main_inner clearfix">
						
						<div class="cont_top_time fr">
							订单池每隔5秒刷新一次
						</div>
					</div>
				</div>
				<div class="main_cont_top">
					<div class="main_inner clearfix">
						<!-- <div class="cont_top_title fl">我的嘿币：<i>0</i> 元</div> -->
						<div class="cont_top_time fr">
							<!-- <select>  
									<option value ="全部订单">全部订单</option>
								</select> -->
							
						</div>
					</div>
				</div>

				<div class="main_cont_bottom">
					<div class="main_inner">

						<table
							class="table table-border table-bordered table-hover table-bg table-sort"
							>
							<table id="orderList">
							
							</table>
						</table>

					</div>
				</div>
			</div>
		</div>
		<div id="messagebox" style="display: none;" class="mask_ddxq">
			<div class="qiangdan">
				<img
					src="${pageContext.request.contextPath}/images/images/close.png"
					class="close" onclick="closeBox()">
				<h3 id="message"></h3>
				<p>
					请前往<a
						href="${pageContext.request.contextPath}/morder/allOrderList/2/1.html">我的订单</a>查看详情
				</p>
			</div>
		</div>
	</div>

	<script type="text/javascript"
		src="${pageContext.request.contextPath}/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script>
	    function init() {
	    	$.ajax({
				type : "GET",
				url : "/morder/waitOrderList.json",
				dataType : "json",
				success : function(data) {
					
					if (data != 0) {

						$('#orderList').empty("");
						$('#orderList').append(data);
					}
				}
			});
	    }
		$(function() {
			$('.table-sort').dataTable({
				"bLengthChange" : false, //改变每页显示数据数量
				"aaSorting" : [ [ 1, "desc" ] ],//默认第几个排序
				"bStateSave" : true,//状态保存
				"bPaginate" : false,// 分页按钮  
				"aoColumnDefs" : [
				//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
				{
					"orderable" : false,
					"aTargets" : [ 0, 2, 2 ]
				} // 制定列不参与排序
				]
			});

			$('.table-sort tbody').on('click', 'tr', function() {
				if ($(this).hasClass('selected')) {
					$(this).removeClass('selected');
				} else {
					table.$('tr.selected').removeClass('selected');
					$(this).addClass('selected');
				}
			});

		});

		function rushOrder(id) {
			$.ajax({
				url : "${pageContext.request.contextPath}/morder/rushOrder/"
						+ id + ".json",
				success : function(data) {
					$("#message").text(data.info);
					$("#messagebox").show();
				}
			});

		}
		function closeBox() {
			$('#messagebox').hide();
		}

		setInterval(function() {
			$.ajax({
				type : "GET",
				url : "/morder/waitOrderList.json",
				dataType : "json",
				success : function(data) {
					
					if (data != 0) {

						$('#orderList').empty("");
						$('#orderList').append(data);
					}
				}
			});
		}, 5000);
	</script>
</body>
</html>

